#include <stdio.h>

struct stu{
    double scores[7];
    char name[100];
} stus;


int main(int argc, char *argv[]) {

    while (scanf("%lf %lf %lf %lf %lf %lf %lf %s", &stus.scores[0], &stus.scores[1], &stus.scores[2], &stus.scores[3], &stus.scores[4], &stus.scores[5], &stus.scores[6], &stus.name) != EOF)
    {
        double sum = 0;

        int max = -1, min = 999;

        for (size_t k = 0; k < 7; k++)
        {
            if(max<stus.scores[k]){
                max = stus.scores[k];
            }else if(min>stus.scores[k]){
                min = stus.scores[k];
            }
            sum += stus.scores[k];
        }
        sum = sum - max - min;
        sum /= 5;
        printf("%s %.2lf\n", stus.name, sum);
    }
    
    return 0;
}